package com.justgame.project.service.system.feign;

import com.justgame.project.cloud.common.constant.AppConstant;
import com.justgame.project.service.system.entity.SysDict;
import com.justgame.project.service.system.feign.fallback.SysDictClientFallback;
import com.justgame.project.service.system.vo.SysDictVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * SysDict 微服务接口
 * @author ZhouWeiBo
 * @create 2022/4/12
 */
@FeignClient( value = AppConstant.SYSTEM,fallback = SysDictClientFallback.class)
public interface ISysDictClient {
    String API_PREFIX = "/feign/sys-dict";
    String GET_DICT_BY_CODE = API_PREFIX + "/get-by-code";
    String GET_DICT_BY_ID = API_PREFIX + "/get-by-id";

    /**
     * 通过Code查询字典表数据
     * @param code code
     * @return List.class
     */
    @GetMapping(GET_DICT_BY_CODE)
    List<SysDict> getDictByCode(@RequestParam("code") String code);

    /**
     * 通过Id查询字典表数据
     * @param id id
     * @return SysDictVO.class
     */
    @GetMapping(GET_DICT_BY_ID)
    SysDictVO getDictById(@RequestParam("id") Long id);
}
